package com.muyu.system.domain.resp;

import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.annotation.Excel.ColumnType;
import com.muyu.common.core.web.domain.BaseEntity;
import com.muyu.system.domain.model.SysDictTypeListModel;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

/**
 * 字典类型列表
 *
 * @author
 */
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class SysDictTypeListResp extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 字典主键
     */
    @Excel(name = "字典主键", cellType = ColumnType.NUMERIC)
    private Long dictId;

    /**
     * 字典名称
     */
    @Excel(name = "字典名称")
    private String dictName;

    /**
     * 字典类型
     */
    @Excel(name = "字典类型")
    private String dictType;

    /**
     * 状态（0正常 1停用）
     */
    @Excel(name = "状态", readConverterExp = "0=正常,1=停用")
    private String status;

    @NotBlank(message = "字典名称不能为空")
    @Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符")
    public String getDictName () {
        return dictName;
    }


    public static SysDictTypeListResp buildResp(SysDictTypeListModel sysDictTypeListModel) {
        return SysDictTypeListResp.builder()
                .dictId(sysDictTypeListModel.getDictId())
                .dictName(sysDictTypeListModel.getDictName())
                .dictType(sysDictTypeListModel.getDictType())
                .status(sysDictTypeListModel.getStatus())
                .build();
    }
}
